package com.example.tests;

import static org.openqa.selenium.support.ui.ExpectedConditions.alertIsPresent;

import java.util.concurrent.TimeUnit;

import org.junit.Before;
import org.openqa.selenium.Alert;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.remote.DesiredCapabilities;
import org.openqa.selenium.support.ui.WebDriverWait;

import com.example.pages.LoginPage;
import com.example.pages.MyPageFactory;

import ru.esteru.selenium.factory.WebDriverFactory;

public class TestBase {
	
	  protected  WebDriver driver;
	  private WebDriverWait wait;
	  private  String baseUrl;
	
	
	  @Before
	  public void setUp() throws Exception {
		driver = WebDriverFactory.getDriver(DesiredCapabilities.chrome());
		wait = new WebDriverWait(driver, 10);
	   // baseUrl = "http://localhost/";
		baseUrl = "http://172.26.40.178";
	    driver.manage().timeouts().implicitlyWait(30, TimeUnit.SECONDS);
	  }
	  
	  protected LoginPage goToMainPage(){
		  driver.get(baseUrl + "/php4dvd/");
		  return MyPageFactory.getPage(driver, LoginPage.class);
	  }
}
